const realTimeStatus = {
    namespaced: true,
    state: {
        TableItem:[],
        pagination:[],
        SearchInfo:[]
    },
    getters: {
        getItem: (state) => {
            
            return state.pagination;
        },
        getSearchItem:(state)=>{
            return state.SearchInfo;
        }
    },
    mutations: {
        setItem: (state, payload) => {
            state.TableItem=[]
            state.TableItem =[...payload];
            
        },
        pagination:(state, Pagination) => {
            state.pagination=[]
            if (state.TableItem) {
                for (let i = (Pagination.curPage - 1) * Pagination.pageSize; i < (Pagination.pageSize * Pagination.curPage)&&i<state.TableItem.length; i++) {
                    if (i > Pagination.dataTotal - 1) {
                        break;
                    }
                    state.pagination.push(state.TableItem[i])
                }
            }
            // state.pagination =[...payload];
        },
        SearchItem:(state,payload)=>{
            
            state.SearchInfo=state.TableItem.filter(_=>{
                
                return _.ip.includes(payload)
            })
            
            
           
            

        },
    },
    actions: {}
};

export default realTimeStatus;